<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2.30</title>
</head>

<body>
    <script>
        let arr = Array.of(1, 2, 3, 4);
        //参数1:用来填充的值
        //参数2:被填充的起始索引
        //参数2(可选):被填充的结束索引，默认为数组末尾
        console.log(arr.fill(0, 1, 2));   //[1,0,3,4]
    </script>
</body>

</html>